package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.SendYzmBean;
import com.lwj.liwanjia.impl.SendYzmView;
import com.lwj.liwanjia.model.SendYzmModel;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/12/1.
 */

public class SendYzmPresenter {
    private SendYzmView sendYzmView;
    private SendYzmModel sendYzmModel;

    public SendYzmPresenter(SendYzmView sendYzmView) {
        this.sendYzmView = sendYzmView;
        sendYzmModel = new SendYzmModel();
    }

    public void sendYzm(String token, String phone) {
        if (sendYzmView != null) {
            sendYzmModel.sendYzm(token, phone, new Subscriber<SendYzmBean>() {
                @Override
                public void onCompleted() {

                }

                @Override
                public void onError(Throwable e) {
                    sendYzmView.showError((Exception) e);
                }

                @Override
                public void onNext(SendYzmBean sendYzmBean) {
                    sendYzmView.sendYzm(sendYzmBean);
                }
            });
        }
    }
}
